package com.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.pojo.Vehicle;
import com.example.mapper.VehicleMapper;
import com.example.pojo.Vehicle;
import com.example.pojo.VehiclePy;
import com.example.mapper.VehiclePyMapper;
import com.example.service.IVehiclePyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.vo.ResultVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jayway.jsonpath.internal.Utils;

import java.util.List;

/**
 * <p>
 * 车辆申请表 服务实现类
 * </p>
 *
 * @author wsl
 * @since 2022-05-06
 */
@Service
public class VehiclePyServiceImpl extends ServiceImpl<VehiclePyMapper, VehiclePy> implements IVehiclePyService {

//    @Override
//    public PageInfo<VehiclePy> queryAllVehiclePy(String empName) {
//        List<VehiclePy> list= baseMapper.queryAllVehiclePy(empName);
//        return new PageInfo<>(list);
//    }

    @Autowired
    private VehicleMapper vehicleMapper;

    @Override
    public ResultVo queryAllVehiclePy(String empName) {
//        QueryWrapper<VehiclePy> wrapper= new QueryWrapper<>();
//        wrapper.eq(!Utils.isEmpty(empName),"empNmae",empName);
        List<VehiclePy> list= baseMapper.queryAllVehiclePy(empName);
        return ResultVo.response(list);
    }

    /**
     * 查询车辆申请表车辆集合
     * @return
     */
    @Override
    public ResultVo queryVehicleList() {
        QueryWrapper<Vehicle> wrapper = new QueryWrapper<>();
        List<Vehicle> vehicles = vehicleMapper.selectList(wrapper);
        return ResultVo.response(vehicles);
    }

    @Override
    public ResultVo createVehiclePy(VehiclePy vehiclePy) {
        //新增车辆申请表记录
        baseMapper.insert(vehiclePy);
        return null;
    }
}
